package cn.demo.app.fallback;

import cn.demo.app.a.domain.User;
import cn.demo.app.api.EchoApi;
import cn.ifloat.brick.logger.core.LogKit;
import cn.ifloat.brick.sprofile.common.ConditionServerMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author: float 2022/11/2 10:02
 */
@Lazy
@Service
@ConditionServerMode
public class EchoFallBack implements EchoApi {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @PostConstruct
    public void init(){
        System.out.println("!!!!!!!!!!!!!!!!!!!!");
    }

    @Override
    public void echo(String msg) {
        logger.info("fallback :" + msg);
    }

    @Override
    public List<User> list(User user) {
        logger.info("list fallback ");
        return null;
    }

    @Override
    public ResponseEntity<byte[]> download() {
        return null;
    }
}
